package com.zzyl.controller.customer;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;

import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders")
@Slf4j
@Api(tags = "护理项目")
public class CustomerProjectController extends BaseController {
    @Autowired
    private NursingProjectService nursingProjectService;

    /**
     * 小程序端分页查询所有的护理项目
     * @param name
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/project/page")
    @ApiOperation("小程序端分页查询护理项目")
    public ResponseResult<NursingProjectVo> getByPage(@ApiParam(value = "护理计划名称") String name,
                                                       @ApiParam(value = "护理计划状态") Integer status,
                                                       @ApiParam(value = "分页页码")@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                                                       @ApiParam(value = "每页显示记录数")@RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
        PageResponse<NursingProjectVo> pageResponse =nursingProjectService.getByPage(name,status,pageNum,pageSize);
        return success(pageResponse);
    }

    /**
     * 根据Id查询
     * @param id
     * @return
     */
    @GetMapping("/project/{id}")
    @ApiOperation("根据id查询")
    public ResponseResult<NursingProjectVo> getById(@ApiParam(value = "id查询")@PathVariable("id") Long id){
        NursingProjectVo nursingProjectVo =  nursingProjectService.getById(id);
        return success(nursingProjectVo);
    }
}
